package com.allianz.webapps.controllers;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.allianz.webapps.https.interfaces.util.ObjectUtil;
import com.fasterxml.jackson.databind.ObjectMapper;

//http://localhost:8080/pad_marketing/main/quoWebView.action
//http://localhost:8080/pad_marketing/main/quoWechat.action

@Controller
@RequestMapping(value="main")
public class QuoWebViewController {

	@Autowired
	private ObjectMapper objectMapper;
	@Autowired
	private ObjectUtil objectUtil;
	
	/**
	 * 建议书邮件预览
	 */
	@RequestMapping(value="quoWebView")
	@ResponseBody
	public String quoWebView(@RequestParam(value="jsonParam") String jsonParam,HttpServletRequest request,HttpServletResponse response)
			throws Exception{
		Object obj=objectMapper.readValue(jsonParam,Object.class);
		String body=objectUtil.requestParam(obj, "quo.getForWebView");
		return body;
	}
	
	/**
	 * 建议书微信预览
	 */
	@RequestMapping(value="quoWechat")
	@ResponseBody
	public String quoWechat(@RequestParam(value="jsonParam") String jsonParam,HttpServletRequest request,HttpServletResponse response)
			throws Exception{
		Object obj=objectMapper.readValue(jsonParam,Object.class);
		String body=objectUtil.requestParam(obj, "quo.getForWechat");
		return body;
	}
	
	
	
}
